import React, { Component } from 'react'
import Login from "./Login";
import Register from "./Register";
import Forget from "./Forget";
import {  Redirect } from "react-router-dom";
import { connect } from "react-redux";
import { saveUserInfo } from "../../redux/actions/login";
import {CacheSwitch, CacheRoute} from 'react-cache-router';
class logins extends Component {
  render() {
    return (
      <div>
        <CacheSwitch>
          <CacheRoute path="/login" render={() => <Login {...this.props} />} />
          <CacheRoute path="/rgister" render={() => <Register {...this.props} />} />
          <CacheRoute path="/forget" render={() => <Forget {...this.props} />} />
        </CacheSwitch>
          <Redirect to="/login" />
      </div>
    )
  }
}
export default connect(
  state => ({ state })
, {
  saveUserInfo
})( logins )